#include<iostream>
using namespace std;
const int N = 110;
int d[N][N];
int n;

int main()
{
	cin >> n;
	while (n--) {
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		x1++, y1++;
		d[x1][y1]++;
		d[x1][y2 + 1]--;
		d[x2 + 1][y1]--;
		d[x2 + 1][y2 + 1]++;
	}
	int ans = 0;
	for (int i = 1; i <= 101; i++) {
		for (int j = 1; j <= 101; j++) {
			d[i][j] += d[i - 1][j] + d[i][j - 1] - d[i - 1][j - 1];
			if (d[i][j])ans++;
		}
	}
	cout << ans << endl;
	return 0;
}